<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>FSF.ExpandEnvironmentStr</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../styles/styles.css">
<script language="javascript" src='../links.js' type="text/javascript"></script>
</head>
<body>

<h1>ExpandEnvironmentStr</h1>
<div class=navbar>
<a href="../index.html">main</a> |
<a href="index.html">FarStandardFunctions</a>
</div>

<div class=shortdescr>
The <dfn>FSF.ExpandEnvironmentStr</dfn> function is used to expand environment
variables in a string to their values.
</div>

<pre class=syntax>
DWORD WINAPI ExpandEnvironmentStr(
  const char *Src,
  char *Dest,
  size_t Size
);
</pre>

<h3>Parameters</h3>
<div class=descr>
  <div class=dfn>Src</div>
  <div class=dfndescr>Pointer to a null-terminated string containing references to environment
  variables of the form: <code>%VariableName%</code>.
  For each such reference, the <code>%VariableName%</code> portion is replaced
  with the current value of that environment variable.
  <p>The replacement rules are the same as those used by the command interpreter.
  Case is ignored when looking up the environment-variable name. If the name is not
  found, the <code>%VariableName%</code> portion is left unchanged.
  </div>

  <div class=dfn>Dest</div>
  <div class=dfndescr>
  Pointer to the buffer that will receive the result of the expansion. May be the same as
  <dfn>Src</dfn>.
  </div>

  <div class=dfn>Size</div>
  <div class=dfndescr>
  Size of the destination buffer (<dfn>Dest</dfn>), including the trailing '\0'.
  </div>

</div>

<h3>Return value</h3>
<div class=descr>
The function returns the number of characters stored into the buffer. If
the environment variable expansion fails, up to (Size-1) characters
are copied from Src to Dest.
</div>

<h3>Remarks</h3>
<div class=descr>
<ol>
<li>This function is just a &quot;wrapper&quot; for the
<a href="win32/ExpandEnvironmentStrings">ExpandEnvironmentStrings</a>
 Windows API function, so you can see Windows API documentation for the details.
<li>Unlike <a href="win32/ExpandEnvironmentStrings">ExpandEnvironmentStrings</a>
<dfn>FSF.ExpandEnvironmentStr</dfn> always fills <dfn>Dest</dfn> buffer.
<li><dfn>Src</dfn> and <dfn>Dest</dfn> must be in the OEM code page.
</div>

</body>
</html>